<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>骨医快线</title>
    <link href="../../../css/mui.plus.css" rel="stylesheet" />
    <style>
    	.mui-table-view-cell>a {
    		white-space: normal!important;
    	}
    	.mui-table-view-cell>a {
    		white-space: normal!important;
    	}
    	.label.label-info {
    		border-radius: 50px;
    		color: #fff;
    		background-color: #30B497;
    	}
    	.label.label-info.unchoose {
    		color: #666;
    		background-color: #eee;
    	} 
    	.form-tags>input {
    		margin-top: 10px;
    		border: none;
    	}
    </style>
</head>
<body>
	<header class="mui-bar mui-bar-nav oe-pri-bar">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">合并症</h1>
	</header>
	<footer class="mui-bar mui-bar-footer" style="padding: 0;height: 50px;">
        <button type="button" id="btn-commit" class="mui-btn mui-btn-primary mui-btn-block" style="padding:10px 0;">保&nbsp;&nbsp;存</button>
    </footer>
	
    <div class="mui-content oe-helper">
    	<ul id="list-input" class="mui-table-view">
    	        <li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_cardiovascular_sys " id="hid1" value="" />
					<a class="mui-navigate-right" href="#">心血管系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-1" class="form-tags">
							<span class="label label-info unchoose">高血压病</span>
							<span class="label label-info unchoose">冠心病</span>
							<span class="label label-info unchoose">高脂血症</span>
							<span class="label label-info unchoose">冠脉支架置入术后</span>
							<span class="label label-info unchoose">房颤</span>
							<span class="label label-info unchoose">陈旧性心梗 </span>
							<span class="label label-info unchoose">心功能不全 </span>
							<span class="label label-info unchoose">心律失常</span>
							<span class="label label-info unchoose">冠脉搭桥术后 </span>
							<span class="label label-info unchoose">风湿性心脏病  </span>
							<span class="label label-info unchoose">心脏起搏器置入术后  </span>
							<span class="label label-info unchoose">肺心病 </span>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_nervous_sys" id="hid2" value="" />
					<a class="mui-navigate-right" href="#">神经精神系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-2" class="form-tags">
							<span class="label label-info unchoose">帕金森病</span>
							<span class="label label-info unchoose">阿尔兹海默病</span>
							<span class="label label-info unchoose">陈旧性脑梗死</span>
							<span class="label label-info unchoose">腔隙性脑梗</span>
							<span class="label label-info unchoose">急性脑梗死</span>
							<span class="label label-info unchoose">脑梗后遗症</span>
							<span class="label label-info unchoose">脑血栓后遗症</span>
							<span class="label label-info unchoose">精神障碍</span>
							<span class="label label-info unchoose">抑郁症 </span>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_respiratory_sys" id="hid3" value="" />
					<a class="mui-navigate-right" href="#">呼吸系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-3" class="form-tags">
							<span class="label label-info unchoose">肺部感染 </span>
							<span class="label label-info unchoose">支气管哮喘 </span>
							<span class="label label-info unchoose">慢性支气管炎 </span>
							<span class="label label-info unchoose">肺气肿</span>
							<span class="label label-info unchoose">支气管扩张 </span>
							<span class="label label-info unchoose">COPD</span>
							<span class="label label-info unchoose">肺癌术后  </span>
							<span class="label label-info unchoose">呼吸衰竭   </span>
							<span class="label label-info unchoose">肺纤维化  </span>
							<span class="label label-info unchoose">陈旧性肺结核   </span>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_urinary_sys" id="hid4" value="" />
					<a class="mui-navigate-right" href="#">泌尿系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-4" class="form-tags">
							<span class="label label-info unchoose">蛋白尿</span>
							<span class="label label-info unchoose">泌尿系感染</span>
							<span class="label label-info unchoose">慢性肾功能不全</span>
							<span class="label label-info unchoose">前列腺炎</span>
							<span class="label label-info unchoose">前列腺增生</span>
							<span class="label label-info unchoose">前列腺癌</span>
							<span class="label label-info unchoose">膀胱癌术后</span>
							<span class="label label-info unchoose">膀胱结石</span>
							<span class="label label-info unchoose">肾性贫血</span>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_digestive_sys" id="hid5" value="" />
					<a class="mui-navigate-right" href="#">消化系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-5" class="form-tags">
							<span class="label label-info unchoose">胃溃疡</span>
							<span class="label label-info unchoose">十二指肠溃疡</span>
							<span class="label label-info unchoose">胆囊炎</span>
							<span class="label label-info unchoose">胆囊结石</span>
							<span class="label label-info unchoose">慢性胃炎</span>
							<span class="label label-info unchoose">胆石症食管癌术后</span>
							<span class="label label-info unchoose">胃大部切除术后</span>
							<span class="label label-info unchoose">胆囊切除术后</span>
							<span class="label label-info unchoose">结肠癌术后</span>
							<span class="label label-info unchoose">肝炎</span>
							<span class="label label-info unchoose">肝硬化</span>
							<span class="label label-info unchoose">反流性食管炎</span>
							<span class="label label-info unchoose">便秘</span>
							<span class="label label-info unchoose">糖尿病</span>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_endocrine" id="hid6" value="" />
					<a class="mui-navigate-right" href="#">内分泌系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-6" class="form-tags">
							<span class="label label-info unchoose">糖尿病</span>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_thrombotic" id="hid7" value="" />
					<a class="mui-navigate-right" href="#">血栓性疾病合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-7" class="form-tags">
							<span class="label label-info unchoose">双下肢动脉硬化</span>
							<span class="label label-info unchoose">双下肢动脉粥样斑块</span>
							<span class="label label-info unchoose">脑血栓</span>
							<span class="label label-info unchoose">下肢深静脉血栓</span>
						</div>
					</div>
				</li>
    	    </ul>
    </div>
    
    <script id="tmp-list-input" type="text/html">
    	{{if data}}
    		<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_cardiovascular_sys " id="hid1" value="{{data.case_complication_cardiovascular_sys}}" />
					<a class="mui-navigate-right" href="#">心血管系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-1" class="form-tags">
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '高血压病'}}">高血压病</span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '冠心病'}}">冠心病</span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '高脂血症'}}">高脂血症</span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '冠脉支架置入术后'}}">冠脉支架置入术后</span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '房颤'}}">房颤</span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '陈旧性心梗'}}">陈旧性心梗 </span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '心功能不全'}}">心功能不全 </span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '心律失常'}}">心律失常</span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '冠脉搭桥术后'}}">冠脉搭桥术后 </span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '风湿性心脏病'}}">风湿性心脏病  </span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '心脏起搏器置入术后'}}">心脏起搏器置入术后  </span>
							<span class="label label-info {{data.case_complication_cardiovascular_sys | match : '肺心病'}}">肺心病 </span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_cardiovascular_sys_remark" value="{{data.case_complication_cardiovascular_sys_remark}}"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_nervous_sys" id="hid2" value="{{data.case_complication_nervous_sys}}" />
					<a class="mui-navigate-right" href="#">神经精神系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-2" class="form-tags">
							<span class="label label-info {{data.case_complication_nervous_sys | match : '帕金森病'}}">帕金森病</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '阿尔兹海默病'}}">阿尔兹海默病</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '陈旧性脑梗死'}}">陈旧性脑梗死</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '腔隙性脑梗'}}">腔隙性脑梗</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '急性脑梗死'}}">急性脑梗死</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '脑梗后遗症'}}">脑梗后遗症</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '脑血栓后遗症'}}">脑血栓后遗症</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '精神障碍'}}">精神障碍</span>
							<span class="label label-info {{data.case_complication_nervous_sys | match : '抑郁症'}}">抑郁症 </span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_nervous_sys_remark" value="{{data.case_complication_nervous_sys_remark}}"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_respiratory_sys" id="hid3" value="{{data.case_complication_respiratory_sys}}" />
					<a class="mui-navigate-right" href="#">呼吸系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-3" class="form-tags">
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '肺部感染'}}">肺部感染 </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '支气管哮喘'}}">支气管哮喘 </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '慢性支气管炎'}}">慢性支气管炎 </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '肺气肿'}}">肺气肿</span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '支气管扩张'}}">支气管扩张 </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : 'COPD'}}">COPD</span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '肺癌术后'}}">肺癌术后  </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '呼吸衰竭'}}">呼吸衰竭   </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '肺纤维化'}}">肺纤维化  </span>
							<span class="label label-info {{data.case_complication_respiratory_sys | match : '陈旧性肺结核'}}">陈旧性肺结核   </span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_respiratory_sys_remark" value="{{data.case_complication_respiratory_sys_remark}}"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_urinary_sys" id="hid4" value="{{data.case_complication_urinary_sys}}" />
					<a class="mui-navigate-right" href="#">泌尿系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-4" class="form-tags">
							<span class="label label-info {{data.case_complication_urinary_sys | match : '蛋白尿'}}">蛋白尿</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '泌尿系感染'}}">泌尿系感染</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '慢性肾功能不全'}}">慢性肾功能不全</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '前列腺炎'}}">前列腺炎</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '前列腺增生'}}">前列腺增生</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '前列腺癌'}}">前列腺癌</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '膀胱癌术后'}}">膀胱癌术后</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '膀胱结石'}}">膀胱结石</span>
							<span class="label label-info {{data.case_complication_urinary_sys | match : '肾性贫血'}}">肾性贫血</span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_urinary_sys_remark" value="{{data.case_complication_urinary_sys_remark}}"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_digestive_sys" id="hid5" value="{{data.case_complication_digestive_sys}}" />
					<a class="mui-navigate-right" href="#">消化系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-5" class="form-tags">
							<span class="label label-info {{data.case_complication_digestive_sys | match : '胃溃疡'}}">胃溃疡</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '十二指肠溃疡'}}">十二指肠溃疡</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '胆囊炎'}}">胆囊炎</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '胆囊结石'}}">胆囊结石</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '慢性胃炎'}}">慢性胃炎</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '胆石症食管癌术后'}}">胆石症食管癌术后</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '胃大部切除术后'}}">胃大部切除术后</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '胆囊切除术后'}}">胆囊切除术后</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '结肠癌术后'}}">结肠癌术后</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '肝炎'}}">肝炎</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '肝硬化'}}">肝硬化</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '反流性食管炎'}}">反流性食管炎</span>
							<span class="label label-info {{data.case_complication_digestive_sys | match : '便秘'}}">便秘</span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_digestive_sys_remark" value="{{data.case_complication_digestive_sys_remark}}"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_endocrine" id="hid6" value="{{data.case_complication_endocrine}}" />
					<a class="mui-navigate-right" href="#">内分泌系统合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-6" class="form-tags">
							<span class="label label-info {{data.case_complication_endocrine | match : '糖尿病'}}">糖尿病</span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_endocrine_remark" value="{{data.case_complication_endocrine_remark}}"/>
						</div>
					</div>
				</li>
				<li class="mui-table-view-cell mui-collapse">
		        	<input type="hidden" name="case_complication_thrombotic" id="hid7" value="{{data.case_complication_thrombotic}}" />
					<a class="mui-navigate-right" href="#">血栓性疾病合并症</a>
					<div class="mui-collapse-content">
						<div id="tag-7" class="form-tags">
							<span class="label label-info {{data.case_complication_thrombotic | match : '双下肢动脉硬化'}}">双下肢动脉硬化</span>
							<span class="label label-info {{data.case_complication_thrombotic | match : '双下肢动脉粥样斑块'}}">双下肢动脉粥样斑块</span>
							<span class="label label-info {{data.case_complication_thrombotic | match : '脑血栓'}}">脑血栓</span>
							<span class="label label-info {{data.case_complication_thrombotic | match : '下肢深静脉血栓'}}">下肢深静脉血栓</span>
							<input type="text" placeholder="自定义字段（多个字段请用逗号分隔）" name="case_complication_thrombotic_remark" value="{{data.case_complication_thrombotic_remark}}"/>
						</div>
					</div>
				</li>
    	{{/if}}
    </script>

    <script src="../../../js/mui.min.js"></script>
    <script src="../../../js/app.js"></script>
    <script src="../../../js/lib/template.js"></script>
    <script src="../../../js/jquery-1.9.1.min.js"></script>
    <script src="../../../js/jquery.tags.min.js"></script>
    <script>
    	(function($, a){
    		template.helper('match', function(data, compareData){
				var reg = new RegExp(compareData);
				return data?(reg.test(data)?'':'unchoose'):'unchoose';
			});
    		
    		var wv,
    			caseId,
    			html,
    			tmpData,
    			commitData;
    			
//  		var hid1 = document.getElementById("hid1"),
//  			hid2 = document.getElementById("hid2"),
//  			hid3 = document.getElementById("hid3"),
//  			hid4 = document.getElementById("hid4"),
//  			hid5 = document.getElementById("hid5"),
//  			hid6 = document.getElementById("hid6"),
//  			hid7 = document.getElementById("hid7");
    			
    		$('body').on('tap', '#btn-commit', function(){
    			commitData = app.form.getJsonFromForm('list-input');
    			commitData.case_id = caseId;
    			
    			CommitDataById(commitData);
    		})
    		
    		setTimeout(function(){
    			$('#tag-1').on('tap', 'span', function(){
    			var self = this,
    				hid1 = document.getElementById("hid1");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid1.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid1.value = hid1.value.replace(self.textContent + ',' , '');
    			}
    		});
    		
    		$('#tag-2').on('tap', 'span', function(){
    			var self = this,
    				hid2 = document.getElementById("hid2");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid2.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid2.value = hid2.value.replace(self.textContent + ',' , '');
    			}
    		});
    		
    		$('#tag-3').on('tap', 'span', function(){
    			var self = this,
    				hid3 = document.getElementById("hid3");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid3.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid3.value = hid3.value.replace(self.textContent + ',' , '');
    			}
    		});
    		
    		$('#tag-4').on('tap', 'span', function(){
    			var self = this,
    				hid4 = document.getElementById("hid4");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid4.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid4.value = hid4.value.replace(self.textContent + ',' , '');
    			}
    		});
    		
    		$('#tag-5').on('tap', 'span', function(){
    			var self = this,
    				hid5 = document.getElementById("hid5");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid5.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid5.value = hid5.value.replace(self.textContent + ',' , '');
    			}
    		});
    		
    		$('#tag-6').on('tap', 'span', function(){
    			var self = this,
    				hid6 = document.getElementById("hid6");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid6.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid6.value = hid6.value.replace(self.textContent + ',' , '');
    			}
    		});
    		
    		$('#tag-7').on('tap', 'span', function(){
    			var self = this,
    				hid7 = document.getElementById("hid7");
    			if(/unchoose/.test(self.classList)){
    				self.classList.remove('unchoose');
    				hid7.value += self.textContent + ',';
    			}else {
    				self.classList.add('unchoose');
    				hid7.value = hid7.value.replace(self.textContent + ',' , '');
    			}
    		});
    		}, 1000);
    		
    		$.plusReady(function(){
    			wv = plus.webview.currentWebview();
    			caseId = wv.caseId;
    			type = wv.type;
				
				getCaseInfoById(caseId, type);
    		});
    		
    		var getCaseInfoById = function(caseId, type){
    			app.net.get('c_old_man_hip_broke_prj_case/show_by_type', {case_id: caseId, case_type: type}, function(data){
    				if(data && data.code === '100') {
    					tmpData = data;
    					html = template('tmp-list-input', tmpData);
    					document.getElementById("list-input").innerHTML = html
    				}
    			});
    		}
    		
    		var CommitDataById = function(commitData){
    			app.net.post('c_old_man_hip_broke_prj_case/update', commitData, function(data){
    				if(data && data.code === '100') {
    					$.toast('保存成功');
    					$.back()
    				}; //渲染模板
    			});
    		}
    		
    	}(mui, app));
    </script>
</body>
</html>